package cn.bandeqing.productInventoryRecord.entity;

import cn.bandeqing.frame.mybatis.config.InsertOrUpdateListener;
import cn.bandeqing.frame.mybatis.entity.BaseEntity;
import cn.bandeqing.order.req.OrderProductSaveReq;
import cn.bandeqing.product.req.ProductChangeInventoryReq;
import cn.bandeqing.product.req.ProductInventorySaveOrUpdateReq;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.Table;
import io.github.linpeilie.annotations.AutoMapper;
import io.github.linpeilie.annotations.AutoMappers;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;

/**
 * 库存变动表 实体类。
 *
 * @author fugui
 * @since 2024-01-29
 */
@EqualsAndHashCode(callSuper = true)
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@Table(value = "bdq_product_inventory_record", onInsert = InsertOrUpdateListener.class, onUpdate = InsertOrUpdateListener.class)
@AutoMappers({
        @AutoMapper(target = ProductChangeInventoryReq.class, convertGenerate = false),
        @AutoMapper(target = ProductInventorySaveOrUpdateReq.class, convertGenerate = false),
        @AutoMapper(target = OrderProductSaveReq.class, convertGenerate = false),
})
public class ProductInventoryRecord extends BaseEntity {

    @Id(keyType = KeyType.Auto)
    private Long productInventoryRecordId;

    private Long inventoryId;

    /**
     * 规格ID
     */
    private Long productSpecificationId;

    private String productSpecification;

    private Long productId;

    private String productName;

    private Double productPrice;

    private Double productTotalPrice;

    /**
     * 店铺ID
     */
    private Long storeId;

    private String storeName;

    private OperateType operateType;

    private Integer afterInventory;

    /**
     * 库存
     */
    private Integer changeInventory;

    private Integer beforeInventory;

    private Long orderId;

    private String remark;

    private ChangeType changeType;

}
